pimpas.Timer = Class.create( );

pimpas.Extends(pimpas.Timer.prototype, pimpas.Object);
pimpas.Extends(pimpas.Timer.prototype, 
	{
		timer: null,
		method: null,
		executing: false,
		isExecuting: function( ) {
			return this.executing;
		},
		ref: null,
		initialize: function(timer, method, ref) {
			this.timer = timer;
			this.method = method;
			this.ref = ref;
		},
		process: function() {
			if(!this.executing) return;
			this.stop( );
			this.method.call(this.ref);
		},
		go: function() {
			if(this.executing) return;
			this.executing = true;
			window.setTimeout(this.process.bind(this), this.timer);
		},
		stop: function() {
			if(!this.executing) return;
			this.executing = false;
		}
	}
);